home *** CD-ROM | disk | FTP | other *** search
/ Adobe Digital Video Collection / Digital Video Collection CD.iso / After Effects 5.5 / MMScriptEng.Cab / F115583_pointat.mm < prev    next >
Encoding:
Text File  |  2001-12-07  |  963 b   |  20 lines

  1. // Point at - Version 1.1
  2.  
  3. // This script makes the layer in popup 1 point at the layer in popup 2
  4. // by setting rotation keyframes so that the y-axis of the layer
  5. // selected in popup 1 always points towards the center of the
  6. // layer selected in popup 2.
  7.  
  8. //      LAYER                                               PROPERTY                     CHANNEL
  9. //      ------                                              ----------                     --------
  10. // 1: Layer you want to be the pointer        doesn't matter               doesn't matter
  11. // 2: Layer to point at                                doesn't matter               doesn't matter
  12.  
  13. delta = value(pop_layer(1), position) - value(pop_layer(2), position);
  14.  
  15. // Compute the angle corresponding to the vector between layer 1 and layer 2
  16. // Subtracts 90, so y-axis point at object rather than x-axis
  17. ang = rad_to_deg(atan2(delta[Y], delta[X])) - 90;
  18.  
  19. value(pop_layer(1), rotation) = ang;
  20.